<?php
class loginAction extends Action
{
	public function login()
	{
		if(isset($_SESSION['yxk_member'])) unset($_SESSION['yxk_member']);
		$this->assign('title',C('WEB_NAME').'登录页面');
		$this->display();
	}
	public function checklogin()
	{
		$db = M('admin');
		$name = $_POST['name'];
		$password = md5($_POST['password']);
		if($userinfo = $db->where('name = "'.$name.'" and password = "'.$password.'"')->find())
		{
			$_SESSION['yxk_member'] = $userinfo['name'];
			$this->redirect('index/index','','1','登录成功！正在进入后台');
		}else
		{
			$this->error('用户名或密码错误，请重试');
		}
	}
}